package day01;

import java.util.Scanner;

public class Hello {
    public static void main(String[] args) {

        System.out.println("ss");
        Scanner sr=new Scanner(System.in);
        int n = sr.nextInt();

        for (int i = n; i>=2; i--) {

            for (int j = 2; j <i; j++) {

                if(i%j==0) {
                    break;
                }
                if(j==i-1) {
                    System.out.println(i);
                    return;
                }
            }
        }


    }
}
